/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "project_problem_category")
@NamedQueries({
    @NamedQuery(name = "ProjectProblemCategory.findAll", query = "SELECT p FROM ProjectProblemCategory p"),
    @NamedQuery(name = "ProjectProblemCategory.findByPpcId", query = "SELECT p FROM ProjectProblemCategory p WHERE p.ppcId = :ppcId"),
    @NamedQuery(name = "ProjectProblemCategory.findByPpcDescrip", query = "SELECT p FROM ProjectProblemCategory p WHERE p.ppcDescrip = :ppcDescrip"),
    @NamedQuery(name = "ProjectProblemCategory.findByPpcName", query = "SELECT p FROM ProjectProblemCategory p WHERE p.ppcName = :ppcName")})
public class ProjectProblemCategory implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ppc_id")
    private Integer ppcId;
    @Column(name = "ppc_descrip")
    private String ppcDescrip;
    @Basic(optional = false)
    @Column(name = "ppc_name")
    private String ppcName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "projectProblemCategory", fetch = FetchType.LAZY)
    private List<ProjectProblem> projectProblemList;

    public ProjectProblemCategory() {
    }

    public ProjectProblemCategory(Integer ppcId) {
        this.ppcId = ppcId;
    }

    public ProjectProblemCategory(Integer ppcId, String ppcName) {
        this.ppcId = ppcId;
        this.ppcName = ppcName;
    }

    public Integer getPpcId() {
        return ppcId;
    }

    public void setPpcId(Integer ppcId) {
        this.ppcId = ppcId;
    }

    public String getPpcDescrip() {
        return ppcDescrip;
    }

    public void setPpcDescrip(String ppcDescrip) {
        this.ppcDescrip = ppcDescrip;
    }

    public String getPpcName() {
        return ppcName;
    }

    public void setPpcName(String ppcName) {
        this.ppcName = ppcName;
    }

    public List<ProjectProblem> getProjectProblemList() {
        return projectProblemList;
    }

    public void setProjectProblemList(List<ProjectProblem> projectProblemList) {
        this.projectProblemList = projectProblemList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ppcId != null ? ppcId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProjectProblemCategory)) {
            return false;
        }
        ProjectProblemCategory other = (ProjectProblemCategory) object;
        if ((this.ppcId == null && other.ppcId != null) || (this.ppcId != null && !this.ppcId.equals(other.ppcId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.ProjectProblemCategory[ppcId=" + ppcId + "]";
    }

}
